{% extends "base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% load dv_filters %}
{% block head_title %}{% blocktrans with year=year %}Configurations cantonales pour {{ year }}{% endblocktrans %}{% endblock %}

{% block content %}
    <h1>{% blocktrans with year=year %}Configurations cantonales pour {{ year }}{% endblocktrans %}</h1>

    <nav>
        <ul class="pager">
            <li class="previous btn-xs">
                <a href="{% url 'annualstatesettings-list' year=year|add:"-1" %}">
                    <span aria-hidden="true">&larr;</span> {{ year|add:"-1" }}
                </a>
            </li>
            {% if year|add:0 != now.year|add:0 %}
                <li class="btn-xs"><a href="{% url 'annualstatesettings-list' year=now.year %}">{% trans "Année courante" %}</a>
                </li>
            {% endif %}
            <li class="next btn-xs">
                <a href="{% url 'annualstatesettings-list' year=year|add:"1" %}">
                    {{ year|add:"1" }} <span aria-hidden="true">&rarr;</span>
                </a>
            </li>
        </ul>
    </nav>
    
    {% for setting in settings %}
        {% if forloop.first %}<table class="table">
        <tr>
            <th>{% trans "Canton" %}</th>
            <th>{% trans "Coût par vélo" %}</th>
            <th>{% trans "Coût par participant" %}</th>
            <th></th>
        </tr>
        {% endif %}
        <tr>
            <td>{{ setting.canton|canton_abbr }}</td>
            <td>{{ setting.cost_per_bike }}</td>
            <td>{{ setting.cost_per_participant }}</td>
            <td>
                {% if user|can:'settings_crud' %}
                    <a class="btn btn-xs btn-primary" href="{% url 'annualstatesetting-update' year=year pk=setting.pk %}" title="{% trans "Éditer" %}"><span class="glyphicon glyphicon-pencil"></span></a>
                {% endif %}
            </td>
        </tr>
        {% if forloop.last %}</table>{% endif %}
    {% endfor %}

    {% if user|can:'settings_crud' %}
        <div>
            <a class="btn btn-primary pull-right" href="{% url 'annualstatesetting-create' year=year %}">{% trans "Créer une nouvelle configuration" %}</a>
        </div>
    {% endif %}
{% endblock %}
